package com.xinlu.util.tool;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.xinlu.derek.common.BaseConstants;

public class CheckImgCode extends HttpServlet {
	
	@Override
	protected void service(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		
		String code = request.getParameter("imgcode");
		String sessionCode = (String) request.getSession().getAttribute(BaseConstants.IMG_CODE_KEY); 
		
		if (sessionCode.equals(code)) {
			
			response.getWriter().write("success");
		}else{
			
			response.getWriter().write("fail");
		}
	}
	
	
	
}
